package com.study.sms.aliyun.unitls;

import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;

import java.io.Serializable;

/**
 * @author mjy
 * @date 2021/12/21
 * @description
 */
public class SmsClient implements Serializable {

    private static final String accessKeyId = "LTAI4GGQfzjPo2xGAbC8PsT7";
    private static final String accessKeySecret = "XwFktlMIUhKHTnMhVGcpgAI5HDsrvp";

    /**
     * 阿里云客户端
     */
    private static Client smsClient;


    private SmsClient() {
    }


    public static Client createClient() {
        if (smsClient == null) {
            Config config = new Config()
                    .setAccessKeySecret(accessKeyId)
                    .setAccessKeySecret(accessKeySecret);
            //配置访问的域名
            config.endpoint = "dysmsapi.aliyuncs.com";
        }
        return smsClient;
    }

    public static String getAccessKeyId() {
        return accessKeyId;
    }

    public static String getAccessKeySecret() {
        return accessKeySecret;
    }

    public static Client getSmsClient() {
        return smsClient;
    }


}
